#pragma once

#include <iostream>
#include <vector>
#include <list>

using std::list;
using std::vector;
using std::cout;
using std::endl;

namespace wu
{
	template <class T, class Container = deque<T>>
	class queue
	{
	public:

		void push(const T& val)
		{
			_con.push_back(val);
		}

		void pop()
		{
			_con.pop_front();//删除头元素
		}

		const T& front()
		{
			return _con.front();//返回头元素的引用
		}

		const T& back()
		{
			return _con.back();//最后一个元素的引用
		}

		size_t size()
		{
			return _con.size();
		}
		
		bool empty()
		{
			return _con.empty();
		}
	private:
		Container _con;
	};

	void test_queue1()
	{
		queue<int> qu;
		qu.push(1);
		qu.push(2);
		qu.push(3);
		qu.push(4);

		while (!qu.empty())
		{
			cout << qu.front() << " ";
			qu.pop();
		}
		cout << endl;
		qu.push(1);
		qu.push(2);
		qu.push(3);
		qu.push(4);

		cout << qu.front() << " " << qu.back() << endl;

		qu.pop();
		while (!qu.empty())
		{
			cout << qu.front() << " ";
			qu.pop();
		}

	}

}